package com.lau.async;

import com.lau.pojo.TSysLog;
import com.lau.service.TSysLogService;
import com.lau.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j;

import java.util.TimerTask;

/**
 * @author:Lau
 * @create: 2022-12-13 17:07
 * @Description: 异步工厂（产生任务用）
 */
@Slf4j
public class AsyncFactory {
    /**
     * 操作日志记录
     *
     * @param operLog 操作日志信息
     * @return 任务task
     */
    public static TimerTask recordOper(final TSysLog operLog) {
        return new TimerTask() {
            @Override
            public void run() {
                SpringUtils.getBean(TSysLogService.class).save(operLog);
            }
        };
    }
}
